﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
using System.ComponentModel;

namespace Chapter15.Code06
{
    public class PersisitentSlider : INotifyPropertyChanged
    {
        private int minValue = 0;
        private int maxValue = 600;
        private int currentValue = 150;

        public event PropertyChangedEventHandler PropertyChanged;

        public int MinValue
        {
            get { return minValue; }
            set { minValue = value; OnPropertyChanded("MinValue"); }
        }

        public int MaxValue
        {
            get { return maxValue; }
            set { maxValue = value; OnPropertyChanded("MaxValue"); }
        }

        public int CurrentValue
        {
            get { return currentValue; }
            set { currentValue = value; OnPropertyChanded("CurrentValue"); }
        }

        protected void OnPropertyChanded(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
